home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-24 | 2.0 KB | 102 lines | [TEXT/MPS ] |
- #include <UMacApp.h>
- #include <UPrinting.h>
- #include <UTEView.h>
- #include <Fonts.h>
- #include <ToolUtils.h>
-
- #include "editor.h"
-
- const OSType kSignature = 'JLMT';
- const OSType kFileType = 'JL01';
- const int kWindowID = 1002;
-
- pascal TEditor::TEditor(OSType itsMainFileType)
- {
- TWindow *aWindow;
- TEditView *aEditView;
- TTEBox *aTEBox;
-
- IApplication(itsMainFileType);
-
- aWindow = NewTemplateWindow(kWindowID,nil);
- FailNIL(aWindow);
-
- if (gDeadStripSuppression)
- {
- aEditView = new TEditView;
- aTEBox = new TTEBox;
- }
-
- aEditView = (TEditView*) aWindow->FindSubView('scrl');
- FailNIL(aEditView);
- aEditView->IEditView(aWindow);
-
- aWindow->Open();
- }
-
- pascal void TEditor::HandleFinderRequest() {};
-
- #ifdef qDebug
- pascal void TEditor::IdentifySoftware()
- {
- ProgramReport("\pEditor ©J.Langowski/MacTutor May 1991",false);
- inherited::IdentifySoftware();
- }
- #endif
-
- pascal void TEditView::IEditView(TWindow *itsWindow)
- {
- TStdPrintHandler *aStdPrintHandler;
-
- aStdPrintHandler = new TStdPrintHandler;
- FailNIL(aStdPrintHandler);
- aStdPrintHandler->IStdPrintHandler
- (nil,this,kSquareDots,kFixedSize,!kFixedSize);
- fPrintHandler = aStdPrintHandler;
-
- fTEView1 = (TTEView*) itsWindow->FindSubView('tx01');
- FailNIL(fTEView1);
- fTEView2 = (TTEView*) itsWindow->FindSubView('tx02');
- FailNIL(fTEView2);
-
- itsWindow->SetTarget(fTEView2);
- }
-
- pascal void TTEBox::Draw(Rect *area)
- {
- Rect itsQDExtent;
-
- PenNormal();
- GetQDExtent(&itsQDExtent);
- FrameRect(&itsQDExtent);
- inherited::Draw(area);
- }
-
- pascal struct TCommand *TTEBox::DoMouseCommand(Point *theMouse,
- EventInfo *info, Point *hysteresis)
- {
- if (Focus())
- { GetWindow()->SetTarget(this); }
-
- return inherited::DoMouseCommand(theMouse,info,hysteresis);
- }
-
-
- TEditor *gEditor;
-
- int main()
- {
- InitToolBox();
- if (ValidateConfiguration(&gConfiguration))
- {
- InitUMacApp(8);
- InitUPrinting();
- InitUTEView();
- gEditor = new TEditor(kFileType);
- FailNIL(gEditor);
- gEditor->Run();
- }
- else StdAlert(phUnsupportedConfiguration);
- return 0;
- }
-